package net.demo.ch01;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/simple.view")
public class SimpleServlet extends HttpServlet
{

	@Override
	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException
	{
		//response.setContentType("text/html;charset=UTF-8");
		PrintWriter out = response.getWriter();
		String name = request.getParameter("name");
		System.out.println("name:" + name);
		
		out.println("<html>");
		out.println("<head>");
		out.println("<title>simple servlet</title>");
		out.println("</head>");
		out.println("<body>");
		out.println("<h1>" + new Date() + "</h1><br>");
		out.println("<h1>来一句中文</h1><br>");
		out.println("<h1>name:" + name + "</h1><br>");
		out.println("</body>");
		out.println("</html>");	
		
	}

}
